#include "Message.h"

#include <boost/regex.hpp>

void Message::from(const std::string& from) {
  _from = from;
}

void Message::rcpt(const std::string& rcpt) {
  _rcpt.push_back(rcpt);
}

void Message::addData(const std::string& data){

  const std::string body_end  = "(.)*\r\n\r\n.\r.$";
  boost::regex self_regex(body_end);

  if (boost::regex_match(data, self_regex)) {
    _done  = true;
  }
  _data += data;
}

bool Message::anyRcpt() {
  return (_rcpt.size() > 0);
}

bool Message::done() {
  return (_done);
}

bool Message::save(){
  return true;
}

Message::Message():_done(false) {
}
